package luogu;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main2089 {
    private static int n;
    private static List<int[]> solutions = new ArrayList<>();
    private static int[] current = new int[10];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        dfs(0, 0);
        System.out.println(solutions.size());
        for (int[] solution : solutions) {
            for (int i = 0; i < 10; i++) {
                System.out.print(solution[i] + " ");
            }
            System.out.println();
        }
    }

    private static void dfs(int index, int sum) {
        if (index == 10) {
            if (sum == n) {
                solutions.add(current.clone());
            }
            return;
        }
        if (sum > n) return;
        int minRemaining = 10 - index;
        int maxRemaining = (10 - index) * 3;
        if (sum + minRemaining > n) return;
        if (sum + maxRemaining < n) return;

        for (int i = 1; i <= 3; i++) {
            current[index] = i;
            dfs(index + 1, sum + i);
        }
    }
}